#pragma once


#include <IXLink.h>
#include "XLabelImpl.h"

template <class I>
class CXLinkImpl : public CXLabelImpl<I>
{
    typedef CXLabelImpl<I> superclass;

    BEGIN_DEF_SKIN_CLASS(CXLink, superclass, gs_strGuidXSkin)
        IMP_BASIC_INTF(IXLink,    0)
    END_DEF_SKIN_CLASS();

    IMPL_CONTROL_OBJ(CXLinkImpl, superclass, _T("Link"));

public:
    CXLinkImpl();
    virtual ~CXLinkImpl();

public:
    // IXLink
    virtual HRESULT STDMETHODCALLTYPE   put_Link(IN LPCTSTR szLink);
    virtual HRESULT STDMETHODCALLTYPE   get_Link(IN BSTR* bstrLink);

    virtual void    STDMETHODCALLTYPE   put_NormalColor(IN COLORREF clrNormal);
    virtual COLORREF STDMETHODCALLTYPE  get_NormalColor();

    virtual void    STDMETHODCALLTYPE   put_HoverColor(IN COLORREF clrHover);
    virtual COLORREF STDMETHODCALLTYPE  get_HoverColor();

    virtual void    STDMETHODCALLTYPE   put_AllColor(IN COLORREF clrAll);

    virtual HRESULT STDMETHODCALLTYPE   put_LinkMode(IN BOOL bLinkMode);
    virtual BOOL    STDMETHODCALLTYPE   get_LinkMode();

    virtual HRESULT STDMETHODCALLTYPE   put_ShowUnderline(IN BOOL bShow);
    virtual BOOL    STDMETHODCALLTYPE   get_ShowUnderline();

public:
    // IXFrame
    virtual void    STDMETHODCALLTYPE   GetAutoSize(OUT LPSIZE pAutoSize);
    virtual void    STDMETHODCALLTYPE   Draw(XCANVAS xCanvas, const RECT& rcDraw);

    virtual BOOL    STDMETHODCALLTYPE   OnMouseHover(IN POINT* pt);
    virtual BOOL    STDMETHODCALLTYPE   OnMouseLeave(IN POINT* pt);
    virtual BOOL    STDMETHODCALLTYPE   OnMouseUp(IN POINT* pt);

protected:
    // CXControlImpl
    virtual HRESULT OnSkinLangChanged();

protected:
    BOOL        m_bLinkMode;
    XString     m_strLink;
    XString     m_strLinkResId;

    COLORREF    m_clrHover;
    BOOL        m_bShowUnderLine;
};


class CXLink : public CXLinkImpl<IXLink>
{
};
